/* ============================================
   STYLE COMPLET - PALETTE MATHS ÉDUCATION NATIONALE
   À utiliser avec index.html, admin.html, prof.html
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ========== EN-TÊTE ========== */
.header {
    background: white;
    border-radius: 20px;
    padding: 25px 30px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.header h1 {
    color: #1B5E20;
    font-size: 24px;
}

.header h1 span {
    background: #4CAF50;
    color: white;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 20px;
    margin-left: 10px;
}

.nav-links {
    display: flex;
    gap: 10px;
}

.nav-link {
    background: #2E7D32;
    color: white;
    padding: 8px 16px;
    border-radius: 50px;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.3s;
}

.nav-link:hover {
    background: #1B5E20;
}

/* ========== ONGLETS ========== */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 25px;
    background: white;
    border-radius: 60px;
    padding: 5px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.tab {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    color: #666;
}

.tab.active {
    background: linear-gradient(135deg, #2E7D32, #1B5E20);
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.tab:hover:not(.active) {
    background: #E8F5E9;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ========== BOUTONS ========== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, #2E7D32, #1B5E20);
    color: white;
    width: 100%;
}

.btn-success {
    background: #4CAF50;
    color: white;
}

.btn-warning {
    background: #FF9800;
    color: white;
}

.btn-danger {
    background: #F44336;
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

/* ========== NAVIGATION PAR NIVEAUX ========== */
.nav-levels {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    justify-content: center;
}

.level-btn, .trimestre-btn {
    background: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #2E7D32;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.level-btn:hover, .trimestre-btn:hover {
    background: #E8F5E9;
    transform: translateY(-2px);
}

.level-btn.active, .trimestre-btn.active {
    background: linear-gradient(135deg, #2E7D32, #1B5E20);
    color: white;
}

.trimestre-nav {
    background: white;
    border-radius: 15px;
    padding: 15px 20px;
    margin-bottom: 25px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ========== GRILLE DES CHAPITRES ========== */
.chapitres-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.chapitre-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.chapitre-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}

.card-header {
    background: linear-gradient(135deg, #2E7D32, #1B5E20);
    color: white;
    padding: 15px 20px;
}

.card-header h3 {
    font-size: 18px;
    margin-bottom: 5px;
    color: white;
}

.card-body {
    padding: 20px;
}

.attendus {
    margin-bottom: 15px;
}

.attendus h4 {
    color: #1B5E20;
    font-size: 14px;
    margin-bottom: 8px;
}

.attendus ul {
    list-style: none;
    padding-left: 0;
}

.attendus li {
    font-size: 13px;
    color: #555;
    padding: 4px 0;
    padding-left: 20px;
    position: relative;
}

.attendus li:before {
    content: "✓";
    color: #4CAF50;
    position: absolute;
    left: 0;
    font-weight: bold;
}

.competences {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.comp-badge {
    background: #f0f0f0;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: #555;
}

/* ========== MODAL ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 25px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    background: linear-gradient(135deg, #2E7D32, #1B5E20);
    color: white;
    padding: 25px 30px;
    position: sticky;
    top: 0;
}

.modal-header h2 {
    color: white;
    font-size: 24px;
    margin-bottom: 8px;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 25px;
    background: none;
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.close-modal:hover {
    opacity: 1;
}

.modal-body {
    padding: 30px;
}

.modal-section {
    margin-bottom: 25px;
}

.modal-section h3 {
    color: #2E7D32;
    font-size: 18px;
    margin-bottom: 12px;
    padding-bottom: 5px;
    border-bottom: 2px solid #eee;
}

.modal-section h4 {
    color: #1B5E20;
    font-size: 15px;
    margin: 15px 0 8px 0;
}

.modal-section ul {
    list-style: none;
    padding-left: 0;
}

.modal-section li {
    padding: 6px 0 6px 20px;
    position: relative;
    color: #444;
}

.modal-section li:before {
    content: "•";
    color: #4CAF50;
    position: absolute;
    left: 5px;
    font-weight: bold;
    font-size: 16px;
}

/* ========== PANNELLES ADMIN ET PROF ========== */
.main-panel {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
}

.config-panel {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    height: fit-content;
}

.config-panel h3 {
    color: #1B5E20;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

.planning-panel {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.planning-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.planning-header h2 {
    color: #1B5E20;
    font-size: 20px;
}

/* ========== FORMULAIRES ========== */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    color: #555;
    font-size: 13px;
}

.form-group select, .form-group input, .form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* ========== PLANNING HEBDOMADAIRE ========== */
.week-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 550px;
    overflow-y: auto;
    padding-right: 10px;
}

.week-row {
    display: grid;
    grid-template-columns: 70px 100px 1fr 80px;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 10px;
    transition: background 0.2s;
}

.week-row.vacances {
    background: #FFF8E1;
}

.week-row:hover {
    background: #E8F5E9;
}

.week-number {
    font-weight: bold;
    color: #2E7D32;
}

.week-date {
    font-size: 11px;
    color: #888;
}

.week-chapitre select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
}

.vacances-badge {
    background: #FF9800;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 20px;
    display: inline-block;
}

/* ========== LISTES ========== */
.plans-list {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.plan-item {
    background: #f8f9fa;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.plan-item:hover {
    background: #E8F5E9;
}

.plan-item.selected {
    background: #E8F5E9;
    border-left: 3px solid #4CAF50;
}

.plan-name {
    font-weight: bold;
    font-size: 13px;
}

.plan-date {
    font-size: 10px;
    color: #888;
}

/* ========== GRILLE COMPÉTENCES ========== */
.competences-grid {
    overflow-x: auto;
}

.competences-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.competences-table th, .competences-table td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: center;
    vertical-align: middle;
}

.competences-table th {
    background: #2E7D32;
    color: white;
    font-weight: bold;
}

.competences-table tr:nth-child(even) {
    background: #f8f9fa;
}

/* ========== SUJETS ========== */
.sujets-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 500px;
    overflow-y: auto;
}

.sujet-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.sujet-card:hover {
    background: #E8F5E9;
    transform: translateX(5px);
}

.sujet-card h4 {
    margin-bottom: 8px;
    color: #1B5E20;
}

.sujet-card p {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.sujet-meta {
    display: flex;
    gap: 15px;
    font-size: 11px;
    color: #888;
}

/* ========== MESSAGES ========== */
.message {
    padding: 10px 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: none;
}

.message.success {
    background: #E8F5E9;
    color: #1B5E20;
    border: 1px solid #A5D6A7;
}

.message.error {
    background: #FFEBEE;
    color: #C62828;
    border: 1px solid #EF9A9A;
}

/* ========== CHARGEMENT ========== */
.loading {
    text-align: center;
    padding: 50px;
    color: #2E7D32;
    font-size: 18px;
}

/* ========== FOOTER ========== */
.footer {
    text-align: center;
    color: #2E7D32;
    padding: 20px;
    font-size: 14px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
    .main-panel {
        grid-template-columns: 1fr;
    }
    
    .tabs {
        flex-wrap: wrap;
        border-radius: 20px;
    }
    
    .chapitres-grid {
        grid-template-columns: 1fr;
    }
    
    .week-row {
        grid-template-columns: 50px 80px 1fr 50px;
        gap: 5px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .header {
        flex-direction: column;
        text-align: center;
    }
    
    .level-btn, .trimestre-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ========== BADGES ========== */
.revision-badge {
    background: #FF9800;
    color: white;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
    margin-left: 10px;
}

.admin-badge {
    background: #4CAF50;
    color: white;
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 20px;
    margin-left: 10px;
}

/* ========== NOTES SECTION ========== */
.notes-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.notes-section h4 {
    margin-bottom: 10px;
    color: #555;
    font-size: 14px;
}

.notes-section textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-family: inherit;
    resize: vertical;
    font-size: 13px;
}

/* ========== AUTO-ÉVALUATION ========== */
.niveau-select {
    padding: 5px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 12px;
}

.badge-na {
    background: #f44336;
    color: white;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
}

.badge-ea {
    background: #ff9800;
    color: white;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
}

.badge-a {
    background: #4caf50;
    color: white;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
}

/* ========== IMAGES ========== */
.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.header-image {
    height: 60px;
    width: auto;
    border-radius: 50%;
}

.promo-image {
    width: 100%;
    max-width: 400px;
    border-radius: 15px;
    margin: 20px auto;
    display: block;
}

/* ============================================
   FONDS D'ÉCRAN PAR SECTION
   Réglages : blanc 0.60 + flou 1px
   ============================================ */

/* SECTION PROGRAMMES */
body.programmes-page {
    background-image: url('/images/programmes1.jpeg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
}
body.programmes-page::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.60);
    backdrop-filter: blur(1px);
    z-index: -1;
}

/* SECTION ÉLÈVES - Mode libre (gratuit) */
body.eleve-mode-libre {
    background-image: url('/images/eleves1.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
}
body.eleve-mode-libre::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.60);
    backdrop-filter: blur(1px);
    z-index: -1;
}

/* SECTION ÉLÈVES - Mode pro (payant) */
body.eleve-mode-pro {
    background-image: url('/images/eleves2.jpeg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
}
body.eleve-mode-pro::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.60);
    backdrop-filter: blur(1px);
    z-index: -1;
}

/* SECTION ÉLÈVES - Mode classe (collectif) */
body.eleve-mode-classe {
    background-image: url('/images/profs2.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
}
body.eleve-mode-classe::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.60);
    backdrop-filter: blur(1px);
    z-index: -1;
}

/* SECTION PARENTS */
body.parent-page {
    background-image: url('/images/famille1.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
}
body.parent-page::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.60);
    backdrop-filter: blur(1px);
    z-index: -1;
}

/* SECTION PROFESSEURS - Version gratuite */
body.professeur-gratuit {
    background-image: url('/images/profs1.jpeg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
}
body.professeur-gratuit::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.60);
    backdrop-filter: blur(1px);
    z-index: -1;
}

/* SECTION PROFESSEURS - Version payante (pro) */
body.professeur-pro {
    background-image: url('/images/profs2.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
}
body.professeur-pro::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.60);
    backdrop-filter: blur(1px);
    z-index: -1;
}